package com.icehand.demo.service.strategy;

import com.icehand.demo.dto.OrderDTO;
import com.icehand.demo.service.OrderService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

@Service("orderServiceV2")
@AllArgsConstructor
public class OrderServiceImplV2 implements OrderService {
    private final OrderHandlerContext orderHandlerContext;

    @Override
    public String handle(OrderDTO dto) {
        AbstractOrderHandler orderHandler = orderHandlerContext.getInstance(dto.getType());
        return orderHandler.handle(dto);
    }
}
